<template>
    <el-dialog v-model="show" title="采购入库详情" width="35%" align-center @close="handleClose">

        <div>
            订单状态: <span style="color: red;">未对账</span>
        </div>


        <div class="mt20 mb20" style="display: flex; align-items: center; justify-content: space-between;">
            采购单号：CG241224001-1

            <el-button link type="primary" @click="detailVisible=true">查看完整采购单</el-button>
        </div>

        <el-table :data="tableData" style="width: 100%">
            <el-table-column prop="date" label="入库时间" align="center" />
            <el-table-column prop="name" label="规格名称" align="center" />
            <el-table-column prop="name" label="入库数量" align="center" />
            <el-table-column prop="name" label="单位" align="center" />
            <el-table-column prop="address" label="入库人" align="center" />
        </el-table>

        <template #footer>
            <div class="dialog-footer">
                <el-button @click="handleClose">取 消</el-button>
                <el-button type="primary" @click="handleSubmit()">保 存</el-button>
            </div>
        </template>

         <!-- 查看详情 -->
         <OrderDetails :visible="detailVisible" @close="detailVisible = false" />
    </el-dialog>
</template>

<script setup lang="ts">
/** 查看详情 */
import OrderDetails from '@/views/purchaseManagement/toBeStored/components/details.vue';
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
const props = defineProps(['visible', 'initList']);
const emits = defineEmits(['submit', 'close']);

const show = ref(false);

watch(() => props.visible, async (newValue) => {
    show.value = newValue
    if (newValue) {
    }
}, { deep: true });

const detailVisible = ref(false);

const tableData = [
    {
        date: '2016-05-03',
        name: 'Tom',
        address: 'No. 189, Grove St, Los Angeles',
    },
    {
        date: '2016-05-02',
        name: 'Tom',
        address: 'No. 189, Grove St, Los Angeles',
    },
    {
        date: '2016-05-04',
        name: 'Tom',
        address: 'No. 189, Grove St, Los Angeles',
    },
    {
        date: '2016-05-01',
        name: 'Tom',
        address: 'No. 189, Grove St, Los Angeles',
    },
]


const handleSubmit = async () => {
    proxy?.$modal.msgSuccess('操作成功');
    emits('submit', true);

    handleClose();
};


const handleClose = () => {
    emits('close');
};

onMounted(() => {
})
</script>

<style lang="scss" scoped></style>